import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { upload } from './release/release.js'
const path = require('path')
// https://vitejs.dev/config/
export default defineConfig({
  // base : './',
  base: process.env.NODE_ENV === 'production' ? 'https://s.hangjiayun.com/zhuanti/unicommon/h5' : './',
  plugins: [
    uni(),
    {
      name: 'upload',
      closeBundle() {
        if (process.env.UNI_PLATFORM === 'h5' && !process.env.UNI_SSR_CLIENT) {
          console.log(`准备上传打包代码`)
          upload()
        }
      }
    }
  ],
  server: {
    host: '0.0.0.0', //自定义主机名
    port: 8991, //自定义端口
    // 是否开启 https
    https: false
  }
})
